w3m 命令详解

| 选择喜欢的代码风格  

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

w3m 命令安装:


-bash/zsh: w3m command not not found

# Windows (WSL2)
sudo apt-get update sudo apt-get install w3m

# Debian
apt-get install w3m

# Ubuntu
apt-get install w3m

# Alpine
apk add w3m

# Arch Linux
pacman -S w3m

# Kali Linux
apt-get install w3m

# CentOS
yum install w3m

# Fedora
dnf install w3m

# OS X
brew install w3m

# Raspbian
apt-get install w3m

# Dockerfile
dockerfile.run/w3m

# Docker
docker run cmd.cat/w3m w3m

w3m 命令补充说明:


w3m 是一款基于文本的浏览器,可以显示本地或远程网页以及其他文档。它能够处理 HTML 表格和框架,但会忽略 JavaScript 和层叠样式表。w3m 还可以用作分页器,分页显示以参数命名或通过标准输入传递的文本文件,以及用作通用目录浏览器。

w3m 将其内容组织在缓冲区或选项卡中,以便于在它们之间轻松导航。安装 w3m-img 扩展程序后,w3m 可以在网页中显示内联图形。当 w3m 的 HTML 渲染功能无法满足您的需求时,只需一个命令即可将目标 URL 移交给图形浏览器。

如需有关运行时选项的帮助,请在运行 w3m 时按 H

w3m 命令语法:


w3m [OPTION]... [ file | URL ]...

w3m 命令选项:


-----------------------
General options
-----------------------
-B
      with no other target defined, use the bookmark page for startup
-H
      use high-intensity colors
-M
      monochrome display
-no-mouse
      deactivate mouse support
-num
      display each line's number
-N
      distribute multiple command line arguments to tabs. By default, a stack of buffers is used
-ppc num
      width of num pixels per character. Range of 4.0 to 32.0, default 8.0. Larger values will make tables narrower. (Implementation not verified)
-ppl num
      height of num pixels per line. Range of 4.0 to 64.0. (Implementation not verified)
-title, -title=TERM
      use the buffer name as terminal title string. With specified TERM, this sets the title configuration style accordingly
-v
      with no other target defined, welcome users with a built-in page
-W
      toggle wrapping mode in searches
-X
      do not initialize/deinitialize the terminal
+num
      go to line num; only effective for num larger than the number of lines in the terminal

-----------------------
Browser options
-----------------------
-cols num
      with stdout as destination; HTML is rendered to lines of num characters
-cookie, -no-cookie
      use stored cookies and accept new ones, or do neither
-F
      render frames
-graph, -no-graph
      use or do not use graphic characters for drawing HTML table and frame borders
-header string
      append string to the HTTP(S) request. Expected to match the header syntax Variable: Value
-m
      Render the body of Usenet messages according to the header “Content-type”
-no-proxy
      do not use proxy
-post file
      use POST method to upload data defined in file. The syntax to be used is var1=value1[&var2=value2]...
-4
      IPv4 only. Corresponds to dns_order=4 in configuration files
-6
      IPv6 only. Corresponds to dns_order=6 in configuration files
-insecure
      use insecure SSL config options, alias for -o ssl_cipher=ALL:eNULL:@SECLEVEL=0 -o ssl_min_version=all -o ssl_forbid_method= -o ssl_verify_server=0

-----------------------
Text pager options
-----------------------
-l num
      number of lines preserved internally when receiving plain text from stdin (default 10,000)
-r
      use caret notation to display special escape characters (such as ANSI escapes or nroff-style backspaces for bold and underlined characters) instead of processing them
-s
      squeeze multiple blank lines into one
-t num
      set tab width to num columns. No effect on stdout

-----------------------
Data type/encoding options
-----------------------
-I charset
      user defined character encoding of input data
-O charset
      user defined character encoding of output data
-T type
      explicit characterization of input data by MIME type

-----------------------
Options for data output, followed by immediate exit
-----------------------
-dump
      dump rendered page into stdout. Set implicitly when output is directed to a file or pipe
-dump_source
      dump the page's source code into stdout
-dump_head
      dump response of a HEAD request for a URL into stdout
-dump_both
      dump HEAD, and source code for a URL into stdout
-dump_extra
      dump HEAD, source code, and extra information for a URL into stdout
-help
      show a summary of compiled-in features and command line options
-show-option
      show all available configuration options
-version
      show the version of w3m

-----------------------
Options for overriding default settings and resources
-----------------------
-bookmark file
      use file instead of the default bookmark.html file
-config file
      use file instead of the default configuration file
-o option=value
      modify one configuration item with an explicitly given value; without option=value, equivalent to -show-option
-debug
      use debug mode (only for debugging)
-reqlog
      log headers of HTTP communication in file ~/.w3m/request.log

w3m 命令实例:


w3m 组合 HTML 代码片段并预览页面:

cat header.html footer.html | w3m -T text/html

w3m 使用 POST 方法上传 URL 数据:

$ w3m -post - http://example.com/form <<<'a=0&b=1'

w3m 打开一个 URL:

w3m https://example.com

w3m 以单色模式打开 URL:

w3m https://example.com -M

w3m 无需鼠标支持即可打开 URL:

w3m https://example.com -no-mouse

w3m 打开一个新的浏览器标签:

<Shift> + T

w3m 显示您的浏览器历史记录:

<Ctrl> + H

退出 w3m:

q + y

w3m 命令扩展阅读:


 

CommandNotFound ⚡️ 坑否 - 其他频道扩展阅读:




w3m 命令评论